package com.qcby.model;

import com.qcby.Constants;
import com.qcby.model.dto.ToRegistDto;
import com.qcby.model.dto.UserForChangeDto;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class User implements Serializable {
    private static final long serialVersionUID = 1067131163310683764L;
    private Integer uid;

    private Date uCreatedAt;

    private String displayName;

    private String username;

    private String password;

    private String phone;

    private String uPic;

    private String uRole;

    public User(ToRegistDto toRegistDto) {
        this(null, new Date(System.currentTimeMillis()), toRegistDto.getDisplayName(), toRegistDto.getUsername(),
                toRegistDto.getPassword(), toRegistDto.getPhone(), Constants.NORMAL_USER_PIC, Constants.NORMQAL_ROLE);
    }

    public User(UserForChangeDto changeDto) {
        this(changeDto.getUid(), null, changeDto.getDisplayName(), changeDto.getUsername(),
                null, changeDto.getPhone(), changeDto.getUPic(), null);
    }
}